package com.easthome.controller;

import com.easthome.entiry.MessageConstant;
import com.easthome.entiry.Result;
import com.easthome.mapper.CheckItemMapper;
import com.easthome.pojo.CheckItem;
import com.easthome.service.CheckItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 检查项请求和响应
 */
@RestController
@RequestMapping("checkItem")
public class CheckItemController {
    //注入业务层对象
    @Autowired
    private CheckItemService checkItemService;

    /**
     * 新增检查项目的数据
     * 接收请求参数，存储到JavaBean对象（pojo）
     * 请求参数是json格式，添加注解接收参数
     */
    @PostMapping("addCheckItem")
    public Result addCheckItem(@RequestBody CheckItem checkItem) {
        checkItemService.addCheckItem(checkItem);
        //响应页面端
        return new Result(true, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }


}
